package ltd.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * 用户类
 */
@Entity
@Table(name = "user")
public class User {
	
	private int id;
	private int gid;
	private String username;
	private String password;
	private String sn;
	private String name;
	private boolean state;
	private boolean type;
	private String regdate;
	private String lastdate;
	
	public User() {
		super();
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}

	@Column(name="username", unique=false, length=50, nullable=false)
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	
	@Column(name="password", unique=false, length=50, nullable=false)
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name="sn", unique=false, length=100, nullable=false)
	public String getSn() {
		return sn;
	}
	public void setSn(String sn) {
		this.sn = sn;
	}

	@Column(name="name", unique=false, length=20, nullable=false)
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	/** 用户状态(false-正常，true-禁用) */
	@Column(name="state", nullable=false)
	public boolean isState() {
		return state;
	}
	/** 用户状态(false-正常，true-禁用) */
	public void setState(boolean state) {
		this.state = state;
	}

	/** 类型(false-普通用户, true-管理员) */
	@Column(name="type", nullable=false)
	public boolean isType() {
		return type;
	}
	/** 类型(false-普通用户, true-管理员) */
	public void setType(boolean type) {
		this.type = type;
	}

	@Column(name="gid", nullable=false)
	public int getGid() {
		return gid;
	}
	public void setGid(int gid) {
		this.gid = gid;
	}

	/** 注册日期 */
	@Column(name="regdate", nullable=true)
	public String getRegdate() {
		return regdate;
	}
	public void setRegdate(String regdate) {
		this.regdate = regdate;
	}
	
	/** 最后一次登录日期 */
	@Column(name="lastdate", nullable=true)
	public String getLastdate() {
		return lastdate;
	}
	public void setLastdate(String lastdate) {
		this.lastdate = lastdate;
	}
	
}
